<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title>访问当当购物车页面节点</title>
    <link type="text/css" rel="stylesheet" href="css/cartStyle.css" />
    <style>
        #box{
            height: 200px;
            background-color: red;
            color: white;
        }
    </style>
</head>
<body>

<div class="content">
    <div class="logo">
        <img src="images/logo.jpg"><span onclick="close_plan();">关闭</span>
    </div>
    <div class="cartList" id="cartList">
        <ul>
            <li>¥<input type="text" name="price" value="159.90"></li>
            <li><input type="button" name="minus" value="-" onclick="minus(0);"><input type="text" name="amount" value="1"><input type="button" name="plus" value="+" onclick="plus(0);"></li>
            <li id="price0">¥159.90</li>
            <li><p  onclick="collection();">移入收藏</p><p onclick="del();">删除</p></li>
        </ul>
        <ul>
            <li>¥<input type="text" name="price" value="159.00"></li>
            <li><input type="button" name="minus" value="-" onclick="minus(1);"><input type="text" name="amount" value="1"><input type="button" name="plus" value="+" onclick="plus(1);"></li>
            <li id="price1">¥159.00</li>
            <li><p  onclick="collection();">移入收藏</p><p onclick="del();">删除</p></li>
        </ul>
        <ol>
            <li id="totalPrice">&nbsp;</li>
            <li><span onclick="accounts();">结 算</span></li>
        </ol>
    </div>
    <div id="box"></div>
</div>
<script type="text/javascript" src="js/shopping.js"></script>
<script>
    function accounts(){
        // 获取商品的小计金额和总金额
        var price0 = document.getElementById("price0").innerHTML;
        var price1 = document.getElementById("price1").innerHTML;

        var totalPrice = document.getElementById("totalPrice").innerHTML;

        // 把金额填写到红色区域中
        // document.getElementsByClassName("content")[0].lastElementChild.innerHTML = price0 + "---" + price1 + "---" + totalPrice;
        document.getElementsByClassName("content")[0].firstElementChild.nextElementSibling.nextElementSibling.innerHTML = price0 + "---" + price1 + "---" + totalPrice;
    }
</script>
</body>
</html>